//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.example.erp.utils;

import brave.Tracer;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;

public class TraceUtils {
    private static final Logger LOGGER = LoggerFactory.getLogger(TraceUtils.class);
    public static boolean flag = true;
    private static Tracer tracer;

    public TraceUtils() {
    }

    public static boolean isSupportTraced() {
        try {
            Class.forName("brave.Tracer");
            return flag;
        } catch (Throwable var1) {
            flag = false;
            return flag;
        }
    }

    public static void setApplicationContext(ApplicationContext context) {
        tracer = (Tracer)context.getBean(Tracer.class);
    }

    public static String getTraceId(HttpServletRequest request) {
        String traceId = request.getHeader("traceID");
        if (StringUtils.isBlank(traceId)) {
            traceId = null != tracer ? tracer.currentSpan().context().traceIdString() : null;
        }

        return traceId;
    }
}
